<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        h1{
            color: brown;
        }
    </style>
    <script type="text/javascript">
        var currentdatetime= new Date();
        document.write(currentdatetime);
        var count=0;
        var interval=setInterval(sample,2000);
        function sample() {
            document.getElementById('text').innerHTML = count;

            count++;
            if(count==3 && !(document.getElementById('btn').clicked)){
                alert('No Click Event Occured');
                clearInterval(interval);
            }
        }
        function btnClick() {
            alert('Button Clicked');
            count=0;
        }

    </script>
</head>
<body>
<h1 id="text">Displaying alert if no event occured....<br></h1>
<input type="button" id="btn" value="Submit" onclick="btnClick()"/>
<script type="text/javascript" src="js/jquery.js"></script>
</body>
</html>